<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html>

	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title><?=SYSTEM_TITLE?></title>

		<link href="<?=base_url("assets/css/bootstrap.min.css")?>" rel="stylesheet">
		<link href="<?=base_url("assets/font-awesome/css/font-awesome.css")?>" rel="stylesheet">

		<!-- Toastr style -->
		<link href="<?=base_url("assets/css/plugins/toastr/toastr.min.css")?>" rel="stylesheet">

		<link href="<?=base_url("assets/css/animate.css")?>" rel="stylesheet">
		<link href="<?=base_url("assets/css/style.css")?>" rel="stylesheet">

		<link href="<?=base_url("assets/css/plugins/dataTables/datatables.min.css")?>" rel="stylesheet">
		<link href="<?=base_url("assets/css/plugins/jasny/jasny-bootstrap.min.css")?>" rel="stylesheet">
				
	</head>

	<body>

		<?$this->load->view("templates/header")?>

        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
				<div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>系统设置</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="table-responsive">
							<table class="table table-striped table-bordered table-hover " >
								<thead>
								<tr>
									<th>代码</th>
									<th>说明</th>
									<th>值</th>
									<th>操作</th>
								</tr>
								</thead>
								<tbody>
									<?foreach($config as $u){?>
										<tr>
											<td><?=$u["cfg_key"]?></td>
											<td><?=$u["cfg_description"]?></td>
											<td><?=$u["cfg_value"]?></td>
											
											<td>
												<a class="btn btn-primary btn-xs" href="<?=site_url("main/config/".$u["cfg_id"])?>"><i class="fa fa-paste"></i> 编辑</a>
											</td>
										</tr>
									<?}?>
								</tbody>
							</table>
						</div>
					</div>
				</div>
            </div>
			<div class="modal inmodal" id="import" tabindex="-1" role="dialog" aria-hidden="true">
				<div class="modal-dialog">
				<div class="modal-content animated bounceInRight">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
							<i class="fa fa-cloud-upload modal-icon"></i>
							<h4 class="modal-title">导入游客信息</h4>
							<small class="font-bold">导入之前请先下载游客信息模板，按照格式整理好数据后才能成功导入。</small>
						</div>
						<div class="modal-body text-center">
							<form id="upload_excel" action="<?=site_url("main/import")?>" method="post" enctype="multipart/form-data">
								<div class="fileinput fileinput-new" data-provides="fileinput">
									<span class="btn btn-default btn-file"><span class="fileinput-new">点击此处选择要导入的表格文件</span>
									<span class="fileinput-exists">选择文件</span><input type="file" name="userfile"/></span>
									<span class="fileinput-filename"></span>
									<a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none">×</a>
								</div> 
							</form>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
							<button type="button" class="btn btn-primary" id="submit_file">提交</button>
						</div>
					</div>
				</div>
			</div>
			<div class="modal inmodal" id="img_modal" tabindex="-1" role="dialog" aria-hidden="true">
				<div class="modal-dialog">
				<div class="modal-content animated bounceInRight">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
							<i class="fa fa-address-card-o modal-icon"></i>
							<h4 class="modal-title">文件浏览</h4>
							<small class="font-bold">点击可以放大图片,放大后可左右滑动切换图片。</small>
						</div>
						<div class="modal-body text-center">
							<div class="lightBoxGallery">
								<a id="usr_file_passport_face" href="" title="护照封面" data-gallery=""><img src="" class="img-thumbnail img-lg"></a>
								<a id="usr_file_passport_inner" href="" title="护照内页" data-gallery=""><img src="" class="img-thumbnail img-lg"></a>
								<a id="usr_file_id_up" href="" title="身份证正面" data-gallery=""><img src="" class="img-thumbnail img-lg"></a>
								<a id="usr_file_id_down" href="" title="身份证反面" data-gallery=""><img src="" class="img-thumbnail img-lg"></a>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
						</div>
					</div>
				</div>
				<!-- The Gallery as lightbox dialog, should be a child element of the document body -->
				<div id="blueimp-gallery" class="blueimp-gallery">
					<div class="slides"></div>
					<h3 class="title"></h3>
					<a class="prev">‹</a>
					<a class="next">›</a>
					<a class="close">×</a>
					<a class="play-pause"></a>
					<ol class="indicator"></ol>
				</div>
			</div>
		</div>

		<?$this->load->view("templates/footer")?>

		<!-- Mainly scripts -->
		<script src="<?=base_url("assets/js/jquery-3.1.1.min.js")?>"></script>
		<script src="<?=base_url("assets/js/bootstrap.min.js")?>"></script>
		<script src="<?=base_url("assets/js/plugins/metisMenu/jquery.metisMenu.js")?>"></script>
		<script src="<?=base_url("assets/js/plugins/slimscroll/jquery.slimscroll.min.js")?>"></script>

		<!-- Custom and plugin javascript -->
		<script src="<?=base_url("assets/js/inspinia.js")?>"></script>
		<script src="<?=base_url("assets/js/plugins/pace/pace.min.js")?>"></script>
		
		<script src="<?=base_url("assets/js/plugins/jasny/jasny-bootstrap.min.js")?>"></script>
		
		<!-- Toastr script -->
		<script src="<?=base_url("assets/js/plugins/toastr/toastr.min.js")?>"></script>


		<script>
		$(document).ready(function(){
			//提交上传的excel表格
			$("#submit_file").click(function(){
				$("#upload_excel").submit();
				$("#submit_file").unbind("click");
			});
			
			toastr.options = {
			  "closeButton": true,
			  "debug": false,
			  "progressBar": true,
			  "preventDuplicates": false,
			  "positionClass": "toast-top-right",
			  "onclick": null,
			  "showDuration": "200",
			  "hideDuration": "1000",
			  "timeOut": "3000",
			  "extendedTimeOut": "1000",
			  "showEasing": "swing",
			  "hideEasing": "linear",
			  "showMethod": "fadeIn",
			  "hideMethod": "fadeOut"
			}
			
			//审核
			$("#btn_audit").click(function(){
				var id = $(this).attr("usr_id");
				$.ajax({
					url:"<?=site_url("main/audit")?>",
					data:{
						usr_id:id
					},
					success:function(){
						toastr["success"]("已成功审核该用户信息.刷新页面可更新显示状态.", "操作成功");
					},
					error:function(){
						toastr["error"]("审核操作失败,请刷新重试 . ", "操作失败");
					}
				});
			});
			
			//浏览文件
			$("#btn_files").click(function(){
				$("#img_modal").modal("show");
				
				$("#usr_file_passport_face").attr("href",$(this).attr("usr_file_passport_face"));
				$("#usr_file_passport_face").find("img").attr("src",$(this).attr("usr_file_passport_face"));
				
				$("#usr_file_passport_inner").attr("href",$(this).attr("usr_file_passport_inner"));
				$("#usr_file_passport_inner").find("img").attr("src",$(this).attr("usr_file_passport_inner"));
				
				$("#usr_file_id_up").attr("href",$(this).attr("usr_file_id_up"));
				$("#usr_file_id_up").find("img").attr("src",$(this).attr("usr_file_id_up"));
				
				$("#usr_file_id_down").attr("href",$(this).attr("usr_file_id_down"));
				$("#usr_file_id_down").find("img").attr("src",$(this).attr("usr_file_id_down"));
			});
			

		});

		</script>
		<?$this->load->view("templates/script")?>
	</body>

</html>
